namespace EPPlayer
{
    /// <summary>
    /// The AttachableAttribute carries Modifiers to be applied during Attach
    /// and to be removed during Detach. A default implementation of OnAttach
    /// is provided.
    /// </summary>
    public abstract class AttachableAttribute : Attribute, IAttachableAttribute
    {
        private readonly Modifiers Modifiers;
        internal AttachableAttribute(
            string Name,
            string Color,
            Modifiers Modifiers,
            string Description = null)
            : base(Name, Color, Description)
        {
            this.Modifiers = Modifiers;
        }
        public virtual void OnAttach(Entity Entity)
        {
            GameResources.AttachModifiers(Entity, this, this.Modifiers);
        }
        public virtual void OnDetach(Entity Entity)
        {
        }
    }
}